home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / ODF / OS / FWGraphx / FWIconSh.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  3.5 KB  |  122 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWIconSh.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWICONSH_H
  11. #define FWICONSH_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. #ifndef FWICON_H
  22. #include "FWIcon.h"
  23. #endif
  24.  
  25. #ifndef FWGCONST_H
  26. #include "FWGConst.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CGraphicContext;
  34.  
  35. //========================================================================================
  36. //    class FW_CIconShape
  37. //========================================================================================
  38.  
  39. class FW_CIconShape : public FW_CBoundedShape
  40. {
  41. public:
  42.     FW_DECLARE_CLASS
  43.     FW_DECLARE_AUTO(FW_CIconShape)
  44.  
  45. //---------------------------------------------------------------------------------------
  46. //    Constructors/Destructors
  47. //
  48. public:
  49.     
  50.                             FW_CIconShape(const FW_CIcon& icon,
  51.                                           const FW_CRect& rect,
  52.                                           FW_RenderIconTransform transform = FW_kIconTransformNone,
  53.                                           FW_RenderIconAlignment alignment = FW_kIconAlignTopLeft);
  54.                         
  55.                             FW_CIconShape(const FW_CIconShape& other);
  56.                             FW_CIconShape(FW_CReadableStream& stream);
  57.  
  58.     virtual                    ~FW_CIconShape();
  59.  
  60. //----------------------------------------------------------------------------------------
  61. //    Operators
  62. //
  63. public:
  64.     FW_CIconShape&            operator=(const FW_CIconShape& other);
  65.  
  66. //---------------------------------------------------------------------------------------
  67. //    Inherited API
  68. //
  69. public:
  70.     // ----- Rendering -----
  71.     virtual void            Render(FW_CGraphicContext& gc) const;
  72.  
  73.     // ----- Copying -----
  74.     virtual FW_CShape*        Copy() const;
  75.     
  76.     // ----- Flatten -----
  77.     virtual void            Flatten(FW_CWritableStream& stream) const;
  78.  
  79. //---------------------------------------------------------------------------------------
  80. //    New API
  81. //
  82. public:
  83.     // ----- Rendering -----
  84.     static void                RenderIcon(FW_CGraphicContext& gc,
  85.                                           const FW_CIcon& icon,
  86.                                        const FW_CRect& rect,
  87.                                        FW_RenderIconTransform transform = FW_kIconTransformNone,
  88.                                        FW_RenderIconAlignment alignment = FW_kIconAlignTopLeft);
  89.  
  90.     // ----- Archiving -----
  91.     static void*            Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  92.  
  93.     // ----- Geometry -----
  94.     void                    GetGeometry(FW_CIcon& icon,
  95.                                         FW_CRect& bounds,
  96.                                         FW_RenderIconTransform& transform,
  97.                                         FW_RenderIconAlignment& alignment) const;
  98.     void                    SetGeometry(const FW_CIcon& icon,
  99.                                         const FW_CRect& bounds,
  100.                                         FW_RenderIconTransform transform = FW_kIconTransformNone,
  101.                                         FW_RenderIconAlignment alignment = FW_kIconAlignTopLeft);
  102.  
  103.     FW_RenderIconTransform    GetIconTransform() const
  104.                                 {return fTransform;}
  105.     void                    SetIconTransform(FW_RenderIconTransform iconTransform)
  106.                                 {fTransform = iconTransform;}
  107.     FW_RenderIconAlignment    GetIconAlignment() const
  108.                                 {return fAlignment;}
  109.     void                    SetIconAlignment(FW_RenderIconAlignment iconAlignment)
  110.                                 {fAlignment = iconAlignment;}
  111.                                 
  112. //---------------------------------------------------------------------------------------
  113. //    Data Members
  114. //
  115. private:
  116.     FW_CIcon                fIcon;
  117.     FW_RenderIconTransform    fTransform;
  118.     FW_RenderIconAlignment    fAlignment;
  119. };
  120.  
  121. #endif // FWICONSH_H
  122.